﻿
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using ABC.Business.Models;
using ABC.Core.Configuration;
using ABC.Domain.Serialization;

namespace ABC.Controllers.ViewModels.My
{
    public class MyKvViewModel : BaseViewModel
    {
        public string Company { get; set; }

        public List<SelectListItem> ListForCompany { get; set; }

        public string Product { get; set; }

        public List<SelectListItem> ListForProduct  { get; set; }

        public List<PolicyItem> PolicyItems { get; set; }

        public int PageNumber { get; set; }

        public int PageCount { get; set; }

        public int PageSize { get; set; }

        public List<SelectListItem> ListForPageSize { get; set; }

        public MyKvViewModel()
        {
            ListForCompany = new List<SelectListItem>();
            var financeModel = IoC.Resolve<FinanceModel>();
            ListForPageSize = new List<SelectListItem>
                                  {
                                      new SelectListItem {Text = "15", Value = "15"},
                                      new SelectListItem {Value = "30", Text = "30"},
                                      new SelectListItem {Text = "50", Value = "50"}                                      
                                  };
            ListForCompany =
                financeModel.GetInsuranceCompanies().Select(x => new SelectListItem {Value = x.Key, Text = x.Value}).
                    ToList();
            PolicyItems = new List<PolicyItem>();
            ListForProduct = new List<SelectListItem>();
            ListForProduct = financeModel.GetTypesOfInsurance().Select(x => new SelectListItem { Value = x.Key, Text = x.Value }).
                    ToList();
        }

    }
}
